<?php
/**
 * Copyright (c) [2019] [吴跃忠]
 * [selibra] is licensed under the Mulan PSL v1.
 * You can use this software according to the terms and conditions of the Mulan PSL v1.
 * You may obtain a copy of Mulan PSL v1 at:
 * http://license.coscl.org.cn/MulanPSL
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
 * PURPOSE.
 * See the Mulan PSL v1 for more details.
 */

namespace Selibra\Http\Protocol;


use Selibra\Config\Config;
use Selibra\Http\Lib\Response;
use Swoole\Http\Response as SwooleHttpResponse;

interface HttpResponseInterface
{

    public function __construct(SwooleHttpResponse $response);


    /**
     * 设置或获取header信息
     * @param $key
     * @param null $value
     * @param array $ucwords
     * @return mixed
     */
    public function header($key, $value = null, $ucwords = []);


    /**
     * 查询头部
     * @return array
     */
    public function selectHeaders();


    /**
     * @return string
     */
    public function getType(): string;


    /**
     * @param string $type
     * @return $this
     */
    public function setType(string $type);


    /**
     * 设置cookie信息
     * @param $name
     * @param null $value
     * @param null $expires
     * @param null $path
     * @param null $domain
     * @param null $secure
     * @param null $httponly
     */
    public function setCookie($name, $value = null, $expires = null, $path = null, $domain = null, $secure = null, $httponly = null);


    /**
     * @return SwooleHttpResponse
     */
    public function sendfile($filename, $offset = null, $length = null);


    /**
     * @return string
     */
    public function getCharset(): string;


    /**
     * @param string $charset
     * @return $this
     */
    public function setCharset(string $charset);


    /**
     * @return mixed
     */
    public function getContent();


    /**
     * @param mixed $content
     * @return $this
     */
    public function setContent($content);

    /**
     * @return int
     */
    public function getStatus(): int;


    /**
     * @param int $status
     * @return $this
     */
    public function setStatus(int $status);


    /**
     * @param $code
     * @return $this
     */
    public function setCode($code);


    /**
     * @return int
     */
    public function getCode();


    /**
     * @return string
     */
    public function getResponseData();


    /**
     * 设置返回消息
     * @param $message
     * @return $this
     */
    public function setMessage($message);


    /**
     * 获取返回消息
     * @return string
     */
    public function getMessage();

}